//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package org.come.mouslisten;

import com.tool.role.RoleTX;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import org.come.Frame.TaobaoCourtMainJframe;
import org.come.Frame.ZhuFrame;
import org.come.Jpanel.TaobaoCourtSplendidJpanel;
import org.come.model.Eshop;
import org.come.until.FormsManagement;

public class AddTeXiaoMouslisten implements MouseListener {

	private Eshop eshop;

	@Override
	public void mouseClicked(MouseEvent e) {
		// TODO Auto-generated method stub

	}

	@Override
	public void mousePressed(MouseEvent e) {
		// TODO Auto-generated method stub

	}

	@Override
	public void mouseReleased(MouseEvent e) {
		if (eshop == null) {
            return;
        }
		// taobaoCourtSplendidJpanel courtJpanel =
		// TaobaoCourtJframe.getTaobaoCourtJframe().getCourtJpanel();
		TaobaoCourtSplendidJpanel taobaoCourtSplendidJpanel = TaobaoCourtMainJframe.getTaobaoCourtJframe()
				.getTaobaoCourtMainJpanel().getTaobaoCourtCardJpanel().getTaobaoCourtSplendidJpanel();
		if (taobaoCourtSplendidJpanel.getEshops() == null) {
            return;
        }
		// 判断是哪个类型
		if ("11".equals(eshop.getEshoptype())) {// 特效
			if (taobaoCourtSplendidJpanel.getEshops()[0] != null) {
				// 将之前的特效移除
				RoleTX.getRoleTX().removeTX(1,
						-Integer.parseInt(taobaoCourtSplendidJpanel.getEshops()[0].getEshopiid()));
			} else {
				// 装扮数加一
				taobaoCourtSplendidJpanel.setZbs(taobaoCourtSplendidJpanel.getZbs() + 1);
			}
			// 将穿戴上去的特效信息保存起来
			taobaoCourtSplendidJpanel.getEshops()[0] = eshop;
		} else if ("12".equals(eshop.getEshoptype())) {// 装饰品
			if (taobaoCourtSplendidJpanel.getEshops()[1] != null) {
				// 将之前的特效移除
				RoleTX.getRoleTX().removeTX(1,
						-Integer.parseInt(taobaoCourtSplendidJpanel.getEshops()[1].getEshopiid()));
			} else {
				// 装扮数加一
				taobaoCourtSplendidJpanel.setZbs(taobaoCourtSplendidJpanel.getZbs() + 1);
			}
			// 将穿戴上去的装饰品信息保存起来
			taobaoCourtSplendidJpanel.getEshops()[1] = eshop;
		} else if ("13".equals(eshop.getEshoptype())) {// 足迹
			if (taobaoCourtSplendidJpanel.getEshops()[2] != null) {
				// 将之前的特效移除
				RoleTX.getRoleTX().removeTX(1,
						-Integer.parseInt(taobaoCourtSplendidJpanel.getEshops()[2].getEshopiid()));
			} else {
				// 装扮数加一
				taobaoCourtSplendidJpanel.setZbs(taobaoCourtSplendidJpanel.getZbs() + 1);
			}
			// 将穿戴上去的装饰品信息保存起来
			taobaoCourtSplendidJpanel.getEshops()[2] = eshop;
		}
		// 给人物穿上特效
		RoleTX.getRoleTX().addTX(1, Math.abs(Integer.parseInt(eshop.getEshopiid())));
		// 判断面板是否打开
		if (FormsManagement.getframe(51).isVisible()) {// 打开
			TaobaoCourtMainJframe.getTaobaoCourtJframe().getTaobaoCourtMainJpanel().getTaobaoCourtCardJpanel()
					.getTaobaoCourtSplendidJpanel().showTxMsg();
		}
	}

	@Override
	public void mouseEntered(MouseEvent e) {
		if (eshop == null) {
            return;
        }
		ZhuFrame.getZhuJpanel().creatgoodtext(eshop);
	}

	@Override
	public void mouseExited(MouseEvent e) {
		ZhuFrame.getZhuJpanel().cleargoodtext();
	}

	public Eshop getEshop() {
		return eshop;
	}

	public void setEshop(Eshop eshop) {
		this.eshop = eshop;
	}
}